<include file="Public:header" />

<div id="page-body">
    <div id="qan-breadcrumbs"><span><a href="{$_global.site_url}">{$Think.lang.home}</a></span>&gt;&nbsp;<span><a href="{$user.user_id|format_user_url=$user['username']}">{$Think.lang.user_activity}</a></span>&gt;&nbsp;<span>{$Think.lang.user_network}</span></div>
    <div id="qan-content">
        <div id="network-container">
            <ul id="network-nav" class="tabs">
                <li <eq name="type" value="follower">class="current"</eq>><a href="{:U('User/network',array('uid'=>$user['user_id'],'type'=>'follower'))}">{$Think.lang.user_followers}</a></li>
                <li <eq name="type" value="following">class="current"</eq>><a href="{:U('User/network',array('uid'=>$user['user_id'],'type'=>'following'))}">{$Think.lang.user_following}</a></li>
                <li <eq name="type" value="block">class="current"</eq>><a href="{:U('User/network',array('uid'=>$user['user_id'],'type'=>'block'))}">{$Think.lang.user_blocklist}</a></li>
            </ul>
            <if condition="$user['perms']['share_network_activity']">
                <notempty name="users">
                <form method="POST" action="{:U('User/network')}">
                <div class="users">
                    <volist name="users" id="vo">
                    <div id="user-{$vo.user_id}" class="profile">
                        <a href="{$vo.user_id|format_user_url=$vo['username']}"><img class="avatar" src="{$vo.email|get_avatar}" alt="{$vo.username}"/></a>
                        <span class="name"><a href="{$vo.user_id|format_user_url=$vo['username']}">{$vo.username}</a></span>
                        <eq name="allowRemove" value="1">
                        <span class="mark"><input type="checkbox" name="mods[]" value="{$vo.user_id}" /></span>
                        </eq>
                        <div class="profile-card"></div>
                    </div>
                    </volist>
                </div>
                <div class="clear"></div>
                <eq name="allowRemove" value="1">
                <p>
                    <input id="mark-all" type="checkbox" name="mark_all" value="1" />
                    <input class="button" type="submit" name="delete" value="{$Think.lang.remove}" />
			        <input type="hidden" name="uid" value="{$user.user_id}" />
			        <input type="hidden" name="type" value="{$type}" />
                </p>
                </eq>
                <div class="pagination">{$pagination}</div>
                <else/>
                <p class="no-results">{$Think.lang.user_no_results}</p>
        		</form>
                </notempty>
            <else/>
            <p class="no-results">{$Think.lang.user_private_network}</p>
            </if>
        </div>
    </div>

    <div id="qan-sidebar">
        <include file="User:sidebar" />
    </div>
</div>

<include file="Public:footer" />

<load href="__PUBLIC__/Js/jquery.selectAll.js" />
<script type="text/javascript">
$(function(){

    $('#mark-all').selectAll({range:'.mark'});
    
    $('.profile').hover(
        function(){
            var uid = $(this).attr('id').substring(5);
            var data = {uid: uid};
            var url = APP + '/Ajax/loadUserProfile';
        	var div = $(this).find('.profile-card');
            var target = $(this).find('.profile-card>.card-container');
            var loading = '<div class="loading">loading...</div>';
            if(target.length == 0){
                div.append(loading);
                $.post(url, data, function(html){
                    div.find('.loading').remove();
                    div.append(html);
                });
            }
            div.show();
        },
        function(){
            var div = $(this).find('.profile-card');
            div.find('.loading').remove();
            div.hide();
        }
    );
});
</script>

